<?php
/**
 * Created by PhpStorm.
 * User: xutao
 * Date: 2018/11/10
 * Time: 16:56
 */
namespace app\admin\controller;
use think\Controller;
use wechat\Msgwechat;

class Wechat extends Controller{


        public function set_meun(){





            $data='{
                 "button":[
                 {    
                      "type":"click",
                      "name":"今日歌曲",
                      "key":"V1001_TODAY_MUSIC"
                  },
                  {
                       "name":"菜单",
                       "sub_button":[
                       {    
                           "type":"view",
                           "name":"搜索",
                           "url":"http://www.soso.com/"
                        },
                        {
                            "type":"view",
                           "name":"搜索",
                           "url":"http://www.soso.com/"
                         },
                        {
                           "type":"click",
                           "name":"赞一下我们",
                           "key":"V1001_GOOD"
                        }]
                   }]
             }';


            $wechat = new \wechat\Wechat();
            $re = $wechat->set_meun($data);
            dump($re);
//            return json(['code'=>200,'data'=>$re,'msg'=>'ok']);
        }

        //获取菜单
    public function get_meun(){
            $wechat = new \wechat\Wechat();
            $re = $wechat->get_meun();
            echo "<pre/>";
            print_r($re);
    }
    //删除菜单
    public function del_meun(){
        $wechat = new \wechat\Wechat();
        $re = $wechat->del_meun();
        dump($re);
    }
    //自定义回复
    public function zdy_msg(){

            $msgwechat = new Msgwechat();
            $msgwechat->valid();


    }
    public function ee(){
            echo phpinfo();
    }
    //客户消息发送
    public function send_text(){
            $wechat = new \wechat\Wechat();
            $wechat->send_text();
    }


}